package com.zzw.hj69;

import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: 矩阵乘法
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static int[][] matrixMulti(int[][] matrixA, int[][] matrixB) {
        if (matrixA[0].length != matrixB.length) {
            throw new IllegalArgumentException("Matrices cannot be multiplied.");
        }
        int[][] matrixC = new int[matrixA.length][matrixB[0].length];
        for (int i = 0; i < matrixA.length; i++) {
            for (int j = 0; j < matrixB[0].length; j++) {
                for (int k = 0; k < matrixA[0].length; k++) {
                    matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
                }
            }
        }
        return matrixC;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        int[][] matrixA = new int[x][y];
        for (int i = 0; i < x; i++) {
            for (int j = 0; j < y; j++) {
                matrixA[i][j] = in.nextInt();
            }
        }
        int[][] matrixB = new int[y][z];
        for (int i = 0; i < y; i++) {
            for (int j = 0; j < z; j++) {
                matrixB[i][j] = in.nextInt();
            }
        }
        int[][] matrixC = matrixMulti(matrixA, matrixB);
        for (int i = 0; i < matrixA.length; i++) {
            for (int j = 0; j < matrixB[0].length; j++) {
                System.out.print(matrixC[i][j] + " ");
            }
            System.out.println();
        }
    }
}